﻿using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MyLib.Web.UI {
	/// <summary>
	/// 
	/// </summary>
	[DefaultProperty("Text")]
	[ToolboxData("<{0}:MyAlertBox runat=\"server\" ></{0}:MyAlertBox>")]	
	public class MyAlertBox : WebControl, ITextControl {
		/// <summary>
		/// 
		/// </summary>
		[Bindable(true)]
		[DefaultValue("")]
		[Localizable(true)]
		[Category("Appearance")]
		[Description("CheckBox_Text")]
		public virtual string Text {
			get {
				string text = (string)this.ViewState["Text"];
				if (text != null) {
					return text;
				}
				return string.Empty;
			}
			set {
				this.ViewState["Text"] = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="writer"></param>
		protected override void RenderContents(HtmlTextWriter writer) {
			writer.Write(@"<button type=""button"" class=""close"" data-dismiss=""alert"">&times;</button>");
			writer.WriteEncodedText(Text);
		}

		/// <summary>
		/// 
		/// </summary>
		public MyAlertBox()
			: base(HtmlTextWriterTag.Div) {
		} // end of MyAlertbox.
	} // end of MyAlertBox.
}
